using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Globalization;
using System.Configuration;

namespace VigilanciaPG
{
    class clsFunciones
    {
        public static string cstrSQL = ConfigurationManager.ConnectionStrings["cstrSQL"].ToString();
        public static  DataTable dtGetData(string sQuery)
        {
            CultureInfo culture = CultureInfo.CreateSpecificCulture("es-MX");
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            DataTable oData = new DataTable();
            try
            {
                SqlDataAdapter sdaRegistro = new SqlDataAdapter(sQuery,cstrSQL);
                sdaRegistro.Fill(oData);
                return oData;
            }
            catch
            {
                return null;
            }
        }


        public static DataSet dtGetDataSet(string sQuery)
        {
            CultureInfo culture = CultureInfo.CreateSpecificCulture("es-MX");
            System.Threading.Thread.CurrentThread.CurrentCulture = culture;
            DataSet oData = new DataSet();
            try
            {
                SqlDataAdapter sdaRegistro = new SqlDataAdapter(sQuery,cstrSQL);
                sdaRegistro.Fill(oData);
                return oData;
            }
            catch
            {
                return null;
            }
        }
       
        public static Boolean nonquery(string sQuery)
        {
            try
            {

                SqlConnection cnn = new SqlConnection(cstrSQL);

                SqlCommand cmd = new SqlCommand(sQuery, cnn);
                cnn.Open();
                cmd.ExecuteNonQuery();
                cnn.Close();
                return true;
            }
            catch {
                return false;
            }
            


                
        }
    }
}
